<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>UCARPP: includes/solution.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">UCARPP
   &#160;<span id="projectnumber">1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('solution_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">includes/solution.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stdbool.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="vehicleState_8h_source.html">vehicleState.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="gMatrix_8h_source.html">gMatrix.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="operations_8h_source.html">operations.h</a>&quot;</code><br/>
</div><div class="textblock"><div class="dynheader">
Include dependency graph for solution.h:</div>
<div class="dyncontent">
<div class="center"><img src="solution_8h__incl.png" border="0" usemap="#includes_2solution_8h" alt=""/></div>
<map name="includes_2solution_8h" id="includes_2solution_8h">
<area shape="rect" id="node5" href="vehicleState_8h.html" title="vehicleState.h" alt="" coords="216,160,320,189"/><area shape="rect" id="node26" href="gMatrix_8h.html" title="gMatrix.h" alt="" coords="613,160,688,189"/><area shape="rect" id="node30" href="operations_8h.html" title="operations.h" alt="" coords="311,83,404,112"/><area shape="rect" id="node7" href="vehiclePath_8h.html" title="vehiclePath.h" alt="" coords="133,237,235,267"/><area shape="rect" id="node20" href="edgeGraph_8h.html" title="edgeGraph.h" alt="" coords="283,237,379,267"/><area shape="rect" id="node11" href="edgeSol_8h.html" title="edgeSol.h" alt="" coords="144,315,224,344"/><area shape="rect" id="node14" href="edgeID_8h.html" title="edgeID.h" alt="" coords="400,392,475,421"/><area shape="rect" id="node37" href="tabooList_8h.html" title="tabooList.h" alt="" coords="395,160,480,189"/><area shape="rect" id="node39" href="tabooExpire_8h.html" title="tabooExpire.h" alt="" coords="387,315,488,344"/></map>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dyncontent">
<div class="center"><img src="solution_8h__dep__incl.png" border="0" usemap="#includes_2solution_8hdep" alt=""/></div>
<map name="includes_2solution_8hdep" id="includes_2solution_8hdep">
<area shape="rect" id="node3" href="los_8h.html" title="includes/los.h" alt="" coords="280,83,381,112"/><area shape="rect" id="node7" href="stm_8h.html" title="includes/stm.h" alt="" coords="5,160,112,189"/><area shape="rect" id="node11" href="ltm_8h.html" title="rappresenta il livello LTM dell&#39;algoritmo UCARPP" alt="" coords="359,315,460,344"/><area shape="rect" id="node15" href="swap_8h.html" title="includes/swap.h" alt="" coords="419,160,533,189"/><area shape="rect" id="node17" href="graphbmp-tools_8h.html" title="includes/graphbmp&#45;tools.h" alt="" coords="608,83,781,112"/><area shape="rect" id="node5" href="add_8h.html" title="includes/add.h" alt="" coords="136,160,243,189"/><area shape="rect" id="node13" href="remove_8h.html" title="includes/remove.h" alt="" coords="267,160,395,189"/><area shape="rect" id="node9" href="LTMConfiguration_8h.html" title="includes/LTMConfiguration.h" alt="" coords="156,237,343,267"/></map>
</div>
</div>
<p><a href="solution_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structSolution.html">Solution</a></td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structSolution.html">Solution</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a8ec291b0d92ca14cd34aa4fd9f72bd66">Solution</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="structSolution.html">Solution</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a9e64ad85b7461afc3a9c84a5bc5c0750">initSolution</a> (int *K, int *N)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="vehiclePath_8h.html#a7ea405f144cc006ea3fe96d97cb01ccd">PvehiclePath</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#ab3ec60e68f6a2ad687fb8c6d5a8807ae">getVehiclePathInSolution</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution, int k)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="vehicleState_8h.html#a22da3b197204806711b0084dc72e971a">PvehicleState</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a0f1f3c91e0034ff71fd2befd0aed6761">getVehicleStateInSolution</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution, int k)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a5072a2da80db8f808eccd298933d6f18">getSolutionProfit</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#ad7fdb3a1a0fe824930b1a14ffc153759">getSolutionTimeCost</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a7a6decb1245b7fd09af80ccfd20ce7dc">getSolutionLoadCost</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#ac97e8436d5b149d167d669b5b406285c">printSolutionProfit</a> (FILE *f, <a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> ps)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#ad7f7ae59dff5c8e929338edaf60b44b8">printSolutionTimeCost</a> (FILE *f, <a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> ps)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a75d3eeb0b6af8b4eb25048843672b6a8">printSolutionLoadCost</a> (FILE *f, <a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> ps)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a6a8d62814bde5eeebec725952d091fc3">cloneSolution</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a1d03c005a6b9866cef38fa6c00aa008a">freeSolution</a> (<a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> psolution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a9b24ad9b677d9167fd5c9c2e54d414a0">printSolution</a> (FILE *f, <a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#a0516856ca7f63d16c297292461eff57e">printVehicles</a> (FILE *f, <a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> solution)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="solution_8h.html#aff2a583ff1bbcd028e542dab99b48047">printVehicleGathering</a> (FILE *f, <a class="el" href="vehiclePath_8h.html#a7ea405f144cc006ea3fe96d97cb01ccd">PvehiclePath</a> p_path, <a class="el" href="gMatrix_8h.html#a8668af44d44e4df02f8db2210adc4982">PGMatrix</a> p_gMatrix, int k)</td></tr>
</table>
<hr/><h2>Typedef Documentation</h2>
<a class="anchor" id="a51498378a2ebad2f10298fbf2ad5613c"></a><!-- doxytag: member="solution.h::Psolution" ref="a51498378a2ebad2f10298fbf2ad5613c" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef <a class="el" href="structSolution.html">Solution</a>* <a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a8ec291b0d92ca14cd34aa4fd9f72bd66"></a><!-- doxytag: member="solution.h::Solution" ref="a8ec291b0d92ca14cd34aa4fd9f72bd66" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef struct <a class="el" href="structSolution.html">Solution</a>  <a class="el" href="structSolution.html">Solution</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>il file comprende la struttura dati che rappresenta una soluzione, ovvero l'insieme di tutti i percorsi eseguiti dai camion compresi tutti gli archi che sono stati soddisfatti. Il file si prefigge inoltre di fornire delle primitive per la gestione della struttura Solutionrappresenta una soluzione del problema UCARPP </p>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a6a8d62814bde5eeebec725952d091fc3"></a><!-- doxytag: member="solution.h::cloneSolution" ref="a6a8d62814bde5eeebec725952d091fc3" args="(Psolution solution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> <a class="el" href="solution_8h.html#a6a8d62814bde5eeebec725952d091fc3">cloneSolution</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Effettua una copia fisica della soluzione. La tabella mostra quali attributi vengono copiati fisicamente e quali invece vengono copiati solo per indirizzo: </p>
<table class="doxtable">
<tr>
<th>Campo </th><th>copia per  </th></tr>
<tr>
<td>K </td><td>indirizzo  </td></tr>
<tr>
<td>gMatrix </td><td>fisicamente  </td></tr>
<tr>
<td>states </td><td>fisicamente  </td></tr>
</table>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>solution non NULL;</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>la soluzione di cui fare una copia </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>un nuova istanza di solution (che dovra' essere deallocata manualmente) </dd></dl>

</div>
</div>
<a class="anchor" id="a1d03c005a6b9866cef38fa6c00aa008a"></a><!-- doxytag: member="solution.h::freeSolution" ref="a1d03c005a6b9866cef38fa6c00aa008a" args="(Psolution psolution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#a1d03c005a6b9866cef38fa6c00aa008a">freeSolution</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>psolution</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>dealloca la soluzione passata dalla memoria.</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>psolution non NULL; </li>
</ul>
</dd></dl>
<dl class="post"><dt><b>Postcondition:</b></dt><dd><ul>
<li>lo spazio occupato dalla cella K (contenente il valore di K NON viene deallocato) </li>
<li>lo spazio occupato dalla struttura <a class="el" href="structSolution.html">Solution</a> viene deallocato; </li>
<li>spazio occupato dall'array states viene deallocato; </li>
<li>lo spazio occupato dall'istanza di gMatrix viene deallocato; </li>
<li>lo spazio occupato dalle istanze dell'array states viene deallocato;</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">psolution</td><td>la soluzione da deallocare </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a7a6decb1245b7fd09af80ccfd20ce7dc"></a><!-- doxytag: member="solution.h::getSolutionLoadCost" ref="a7a6decb1245b7fd09af80ccfd20ce7dc" args="(Psolution solution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="solution_8h.html#a7a6decb1245b7fd09af80ccfd20ce7dc">getSolutionLoadCost</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>ottiene il carico totale usato dai camion ottenuto da questa soluzione</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>solution non NULL</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>la soluzione di cui rilevare il profitto totale </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>la somma dei carichi usati da ciascun camion in soluzione </dd></dl>

</div>
</div>
<a class="anchor" id="a5072a2da80db8f808eccd298933d6f18"></a><!-- doxytag: member="solution.h::getSolutionProfit" ref="a5072a2da80db8f808eccd298933d6f18" args="(Psolution solution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="solution_8h.html#a5072a2da80db8f808eccd298933d6f18">getSolutionProfit</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>ottiene il profitto totale ottenuto da questa soluzione</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>solution non NULL</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>la soluzione di cui rilevare il profitto totale </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>il profitto totale offerto da tutti i camion in soluzione </dd></dl>

</div>
</div>
<a class="anchor" id="ad7fdb3a1a0fe824930b1a14ffc153759"></a><!-- doxytag: member="solution.h::getSolutionTimeCost" ref="ad7fdb3a1a0fe824930b1a14ffc153759" args="(Psolution solution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="solution_8h.html#ad7fdb3a1a0fe824930b1a14ffc153759">getSolutionTimeCost</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>ottiene il tempo totale speso dai camion ottenuto da questa soluzione</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>solution non NULL</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>la soluzione di cui rilevare il profitto totale </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>la somma dei tempi spesi da ciascun camion in soluzione </dd></dl>

</div>
</div>
<a class="anchor" id="ab3ec60e68f6a2ad687fb8c6d5a8807ae"></a><!-- doxytag: member="solution.h::getVehiclePathInSolution" ref="ab3ec60e68f6a2ad687fb8c6d5a8807ae" args="(Psolution solution, int k)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="vehiclePath_8h.html#a7ea405f144cc006ea3fe96d97cb01ccd">PvehiclePath</a> <a class="el" href="solution_8h.html#ab3ec60e68f6a2ad687fb8c6d5a8807ae">getVehiclePathInSolution</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>k</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>TODO riciclare o cancellare aggiunge l'arco passato come parametro nel percorso effettuato dal camion k. Per esempio, ipotizzando che il percorso del camion sia: </p>
<p>(0-4)(4-3)(3-6)(6-1)(1-0) l'arco da inserire sia 6-5. Dopo la funzione il percorso del camion sara': </p>
<p>(0-4)(4-3)(3-6)(6-1)(1-0)(6-5) notare che la funzione rende il percorso assolutamente non corretto. Sara' la funzione chiamante che dovra' occuparsi di effettuare piu' chiamate in modo da rendere il percorso accettabile.</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>solution non deve essere NULL </li>
<li>id non deve essere NULL </li>
<li>id deve avere i&lt;j </li>
<li>k&gt;=0 e k&lt;=K </li>
</ul>
</dd></dl>
<dl class="post"><dt><b>Postcondition:</b></dt><dd>esistono varie casistiche: <ul>
<li>se id era già contenuto nel percorso, il campo x di tale arco viene incrementato di 1 </li>
<li>se id non era gia' presente, viene aggiunto al percorso con x=1 </li>
<li>se _g e' TRUE k viene inserito nella matrice g soovrascrivendo il valore precedente</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>indica la soluzione in cui inserire l'arco </td></tr>
    <tr><td class="paramname">k</td><td>indica il camion </td></tr>
    <tr><td class="paramname">id</td><td>indica l'edge da inserire. L'edge viene inserito in coda se non esiste nel percorso, mentre viene aumentato il valore del campo x se esiste gia' </td></tr>
    <tr><td class="paramname">edge</td><td>indica le caratteristiche fisiche dell'arco da aggiungere </td></tr>
    <tr><td class="paramname">_g</td><td>indica se l'arco deve essere soddisfatto (TRUE) oppure no (FALSE) TODO riciclare o cancellare rimuove un arco all'interno della soluzione. La funzione aggiorna inoltre anche il campo camionLengths della soluzione</td></tr>
  </table>
  </dd>
</dl>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>solution non deve essere NULL </li>
<li>k&gt;=0 e k&lt;=K </li>
<li>id non NULL </li>
<li>id deve avere i&lt;j</li>
</ul>
</dd></dl>
<dl class="post"><dt><b>Postcondition:</b></dt><dd>ci sono varie casistiche: <ul>
<li>se l'arco non era dentro il percorso non succede nulla </li>
<li>se l'arco era percorso piu' di una volta viene decremantato di 1 il campo x dell'arco </li>
<li>se l'arco era percorso solo una volta viene tolto dal percorso</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>indica la soluzione da modificare </td></tr>
    <tr><td class="paramname">k</td><td>indica il camion k da considerare </td></tr>
    <tr><td class="paramname">edge</td><td>indica l'edge da togliere. </td></tr>
    <tr><td class="paramname">solution</td><td>la soluzione che contiene il percorso del camion </td></tr>
    <tr><td class="paramname">k</td><td>il camion di cui reperire il percorso </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>il percorso eseguito dal camion k nella soluzione solution </dd></dl>

</div>
</div>
<a class="anchor" id="a0f1f3c91e0034ff71fd2befd0aed6761"></a><!-- doxytag: member="solution.h::getVehicleStateInSolution" ref="a0f1f3c91e0034ff71fd2befd0aed6761" args="(Psolution solution, int k)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="vehicleState_8h.html#a22da3b197204806711b0084dc72e971a">PvehicleState</a> <a class="el" href="solution_8h.html#a0f1f3c91e0034ff71fd2befd0aed6761">getVehicleStateInSolution</a> </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>k</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">solution</td><td>la soluzione che contiene il percorso del camion </td></tr>
    <tr><td class="paramname">k</td><td>il camion di cui reperire il percorso </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>lo stato del camion k nella soluzione solution </dd></dl>

</div>
</div>
<a class="anchor" id="a9e64ad85b7461afc3a9c84a5bc5c0750"></a><!-- doxytag: member="solution.h::initSolution" ref="a9e64ad85b7461afc3a9c84a5bc5c0750" args="(int *K, int *N)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a> <a class="el" href="solution_8h.html#a9e64ad85b7461afc3a9c84a5bc5c0750">initSolution</a> </td>
          <td>(</td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>K</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>N</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>costruisce una nuova soluzione gia' provvista di tutti i puntatori necessari per poter usare le funzioni di questo header. </p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>N e K non devono essere NULL </li>
</ul>
</dd></dl>
<dl class="post"><dt><b>Postcondition:</b></dt><dd><ul>
<li>una struttura <a class="el" href="structSolution.html">Solution</a> in memoria, oppure NULL se la memoria disponibile non è sufficiente</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">K</td><td>un puntatore ad una cella di memoria che contiene il numero di camion usati nella soluzione </td></tr>
    <tr><td class="paramname">N</td><td>un puntatore ad una cella di memoria che contiene il numero di nodi presenti nel grafo </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>un puntatore che consente l'accesso ai campi della soluzione; viene mostrato un messaggio di errore in caso la memoria sia piena </dd></dl>

</div>
</div>
<a class="anchor" id="a9b24ad9b677d9167fd5c9c2e54d414a0"></a><!-- doxytag: member="solution.h::printSolution" ref="a9b24ad9b677d9167fd5c9c2e54d414a0" args="(FILE *f, Psolution solution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#a9b24ad9b677d9167fd5c9c2e54d414a0">printSolution</a> </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Wrappa printVehiclesStates aggiungendovi la lunghezza del percorso. TODO see l'altro to_do in struct <a class="el" href="structSolution.html">Solution</a></p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>il file su cui stampare la rappresentazione della soluzione </td></tr>
    <tr><td class="paramname">solution</td><td>la soluzione da stampare </td></tr>
    <tr><td class="paramname">printMarked</td><td>se stampare o no i valori marked. Siccome sono più di debug che di interesse utente, è giusto poterli inibire. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a75d3eeb0b6af8b4eb25048843672b6a8"></a><!-- doxytag: member="solution.h::printSolutionLoadCost" ref="a75d3eeb0b6af8b4eb25048843672b6a8" args="(FILE *f, Psolution ps)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#a75d3eeb0b6af8b4eb25048843672b6a8">printSolutionLoadCost</a> </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>ps</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>stampa la somma dei carichi di ciasun camion all'interno della soluzione ps</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>ps non NULL </li>
<li>f aperto in scrittura</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>il file su cui stampare il profitto ricavato </td></tr>
    <tr><td class="paramname">ps</td><td>la soluzione da cui ricavare il carico totale </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ac97e8436d5b149d167d669b5b406285c"></a><!-- doxytag: member="solution.h::printSolutionProfit" ref="ac97e8436d5b149d167d669b5b406285c" args="(FILE *f, Psolution ps)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#ac97e8436d5b149d167d669b5b406285c">printSolutionProfit</a> </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>ps</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>stampa il profitto totale ricavato dalla soluzione ps</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>ps non NULL </li>
<li>f aperto in scrittura</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>il file su cui stampare il profitto ricavato </td></tr>
    <tr><td class="paramname">ps</td><td>la soluzione da cui ricavare il profitto totale </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="ad7f7ae59dff5c8e929338edaf60b44b8"></a><!-- doxytag: member="solution.h::printSolutionTimeCost" ref="ad7f7ae59dff5c8e929338edaf60b44b8" args="(FILE *f, Psolution ps)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#ad7f7ae59dff5c8e929338edaf60b44b8">printSolutionTimeCost</a> </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>ps</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>stampa la somma dei tempi di ciasun camion all'interno della soluzione ps</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>ps non NULL </li>
<li>f aperto in scrittura</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>il file su cui stampare il profitto ricavato </td></tr>
    <tr><td class="paramname">ps</td><td>la soluzione da cui ricavare il tempo totale </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="aff2a583ff1bbcd028e542dab99b48047"></a><!-- doxytag: member="solution.h::printVehicleGathering" ref="aff2a583ff1bbcd028e542dab99b48047" args="(FILE *f, PvehiclePath p_path, PGMatrix p_gMatrix, int k)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#aff2a583ff1bbcd028e542dab99b48047">printVehicleGathering</a> </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="vehiclePath_8h.html#a7ea405f144cc006ea3fe96d97cb01ccd">PvehiclePath</a>&#160;</td>
          <td class="paramname"><em>p_path</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="gMatrix_8h.html#a8668af44d44e4df02f8db2210adc4982">PGMatrix</a>&#160;</td>
          <td class="paramname"><em>p_gMatrix</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>k</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Stampa una lista in formato printVehiclePath ma limitata agli archi raccolti. Per esempio se il percorso e' </p>
<p>{(1 2)[gathered] (2 3) (3 4) (4 5)[gathered] (5 1)} dove per [gathered] si intende che il particolare camion k raccoglie l'arco il risultato sara' </p>
<p>{(1 2) (4 5)}</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>f aperto in scrittura </li>
<li>p_path non NULL </li>
<li>p_gMatrix non NULL </li>
<li>k appartiene a [0;K[</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>il file su cui stampare </td></tr>
    <tr><td class="paramname">p_path</td><td>il percorso da stampare </td></tr>
    <tr><td class="paramname">p_gMatrix</td><td>la matrice dei raccoglimenti </td></tr>
    <tr><td class="paramname">k</td><td>il camion usato </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a0516856ca7f63d16c297292461eff57e"></a><!-- doxytag: member="solution.h::printVehicles" ref="a0516856ca7f63d16c297292461eff57e" args="(FILE *f, Psolution solution)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="solution_8h.html#a0516856ca7f63d16c297292461eff57e">printVehicles</a> </td>
          <td>(</td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="solution_8h.html#a51498378a2ebad2f10298fbf2ad5613c">Psolution</a>&#160;</td>
          <td class="paramname"><em>solution</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Approccio Pat alla stampa della soluzione. Invece della <a class="el" href="structGMatrix.html">GMatrix</a>, invoca K <a class="el" href="solution_8h.html#aff2a583ff1bbcd028e542dab99b48047">printVehicleGathering()</a> (cfr procedura)</p>
<dl class="pre"><dt><b>Precondition:</b></dt><dd><ul>
<li>f aperto in scrittura </li>
<li>solution non NULL</li>
</ul>
</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">f</td><td>il file su cui stampare la rappresentazione della soluzione </td></tr>
    <tr><td class="paramname">solution</td><td>la soluzione da stampare </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="solution_8h.html">solution.h</a>      </li>

    <li class="footer">Generated on Wed Sep 4 2013 06:38:57 for UCARPP by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
